/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Tomek
 */
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Connection myCon;
        Statement myStmt;
        try {   new org.postgresql.Driver();
            // Connect to an instance of mysql with the follow details:
            // machine address: pc236nt.napier.ac.uk
            // database       : gisq
            // user name      : scott
            // password       : tiger
            Scanner s = new Scanner(System.in);
            //System.out.println("Podaj hasło:");
            myCon = DriverManager.getConnection(
                    "jdbc:postgresql://localhost:9999/zztbak01",
                    "zztbak01", "nun4ALnXqCzn");
            myStmt = myCon.createStatement();
            ResultSet result = myStmt.executeQuery(
                    "Select id, opis from atrakcje");
            while (result.next()) {
                System.out.println(result.getString("opis"));
            }
            myCon.close();
        } catch (Exception sqlEx) {
            System.err.println(sqlEx);
        }
    }
}
